import React from 'react'
import {connect} from 'dva-no-router'
import {bindActionCreators} from 'redux'
import UI from '../components/projectsList';

class App extends React.Component {
    componentWillMount(){
        const {getTableList}=this.props;
        getTableList();
    }
    // componentDidMount() {
    //     const {getTableList}=this.props;
    //     getTableList();
    // }
    componentWillUnmount(){
        const {getClean}=this.props;
        getClean();
    }
  render() {
    return (
      <UI {...this.props}/>
    )
  }
}

const actions = {
    search:() => ({type: 'projectsList/search'}),
    queryTasks: (val) => ({type: 'projectsList/queryTasks', payload: val}),
    setProjectId: (val) => ({type: 'projectsList/setProjectId', payload: val}),
    getTableList:() =>({type:'projectsList/getTableList'}),
    getClean:() =>({type:'projectsList/getClean'}),
    dialogShow:() =>({type:'projectsList/dialogShow'}),
    changeText:(val) =>({type:'projectsList/changeText',payload:val}),
    getId:(val) =>({type:'projectsList/getId',payload:val}),
};

const mapProps = ({projectsList}) => ({...projectsList});

const mapActions = dispatch => ({
  ...bindActionCreators({...actions}, dispatch)
});

export default connect(mapProps, mapActions)(App)